package com.project_test.kun.travelling_1st.HomePage.Util;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

/**
 *  Created by Administrator on 16-10-16.
 */
public class URL {
    public static final String HOMEPAGER_URL="http://www.handybest.com/index.php?m=Api&c=index&a=getIndexData&device_token=864394010925172&push_token=363646a50016412a414f89bae67b47cd972d5bd5&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String DETAIL_PATH_1="http://www.handybest.com/index.php?m=Api&c=Topics&a=topic_info&id=";
    public static final String DETAIL_PATH_2="&device_token=864394010925172&push_token=363646a50016412a414f89bae67b47cd972d5bd5&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String HOMEPAGER_CAR_COMMONT="http://www.handybest.com/index.php?m=Api&c=Search&a=car_page";//接口前端
    public static final String CAR_TYPE_ID="&type=";//汽车类型--->可选
    public static final String HOMEPAGER_CAR_CITY_ID="&city_id=" ;//城市类型
    public static final String CAR_MAX="&sort=price_desc";//按高到低排列
    public static final String CAR_MIN="&sort=price_asc";//按低到高排列
    public static final String CAR_PAGE="&p=";//加载页数
    public static final String HOMEPAGER_CAR_LASTCOMMONT="&device_token=864394010925172&push_token=48c3e0cad9df6d2e4446b318711cdb7e09784448&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String HOMEPAGER_CAR_DEFAULT="http://www.handybest.com/index.php?m=Api&c=Search&a=car_page&city_id=143&p=1&device_token=864394010925172&push_token=363646a50016412a414f89bae67b47cd972d5bd5&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String HOMEPAGER_CAR_TYPE="http://www.handybest.com/index.php?m=Api&c=Vehicle&a=baseData&device_token=864394010925172&push_token=363646a50016412a414f89bae67b47cd972d5bd5&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String HOMEPAGER_HOUSE_COMMON="http://www.handybest.com/index.php?m=Api&c=Search&a=hotel_page";
    public static final String HOUSE_CITY_ID="&city_id=";
    public static final String HOUSE_PAGE="&p=";
    public static final String HOMEPAGER_HOUSE_LASTCOMMON="&device_token=864394010925172&push_token=363646a50016412a414f89bae67b47cd972d5bd5&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";
    public static final String DETAIL_HOUSE_COMMON="http://www.handybest.com/index.php?m=Api&c=Hotel&a=hotelDetail";
    public static final String DETAIL_HOUSE_HID="&hid=";
    public static final String DETAIL_HOUSE_LASTCOMMON="&device_token=864394010925172&push_token=48c3e0cad9df6d2e4446b318711cdb7e09784448&mobile_type=Android&mobile_model=GT-N7100%2C4.4.2&version_code=10000";





    public static Bitmap twoCollect(Context context, int id, int height, int width) {
        //图片的二次采样
        //1.第一次采样,并不返回bitmap,仅仅返回原始图片宽高
        BitmapFactory.Options options=new BitmapFactory.Options();//配置类
        options.inJustDecodeBounds=true;//只得到原始的尺寸,并不得到图片具体像素
        Bitmap bitmapFirst = BitmapFactory.decodeResource(context.getResources(),id,options);//此时的bitamp是空的

        //获取原始图片的宽高
        int srcHeight = options.outHeight;
        int srcWidth = options.outWidth;
//              设计需求,如:宽50,高80;

        //2.第二次采样
        options.inJustDecodeBounds=false;//获得原有像素
        options.inPreferredConfig=Bitmap.Config.RGB_565;
        int samleSize=1;
        while(srcWidth/samleSize>width|srcHeight/samleSize>height){
            samleSize*=2;
        }
        options.inSampleSize=samleSize;
        Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(),id,options);
        return bitmap;
    }
}